<template>
    <div>
        <h3>欢迎光临,你在这一定会吃到带虫子的水果.因为纯天然,无公害</h3>
        <span> 苹果{{a}}¥/斤</span><span>折扣后{{b*10}} 折</span>
        <p>请输入你所购买的斤数<input type="number" v-model="num"></p>

        <p>
            <button @click="btn">结账买单</button>
            结账:
            <span>总价:{{c}}¥元</span>
            <span>折后价:{{d}}¥元</span>
            <span>节省:{{e}}¥元</span>
        </p>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                a: 10,
                b: 0.8,
                c: '',
                d: '',
                e: '',
                num: 0



            }
        },
        methods: {
            btn() {
                this.c = this.a * this.num
                this.d = this.c * this.b
                this.e = this.c - this.d
            }
        }
    }
</script>

<style>

</style>